package com.itheima.bos.web.action.system;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import com.itheima.bos.domain.system.Permission;
import com.itheima.bos.service.system.IPermissionService;
import com.itheima.bos.web.action.common.BaseAction;

public class PermissionAction extends BaseAction<Permission> {

	@Autowired
	private IPermissionService permissionService;

	@Action(value = "permission_list", results = { @Result(name = "success", type = "json") })
	public String list() {

		List<Permission> permissions = permissionService.findAll();
		
		pushPageDataToValueStack(permissions);
		return SUCCESS;
	}
	@Action(value="permission_save",results={@Result(name="success",location="pages/system/permission.html",type="redirect")})
	public String save(){
		
		//调用业务层，保存权限
		permissionService.save(model);
		
		return SUCCESS;
	}
}
